#ifndef __FUNC_H__
#define __FUNC_H__

#include <errno.h>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <stdexcept>
#include <vector>
#include <sstream>

#include <stdint.h>	///usr/include/stdint.h

const int TF_INT_32 = 0;
const unsigned TF_UINT_32 = 0;
const int64_t TF_INT_64 = 0;
const uint64_t TF_UINT_64 = 0;
const double TF_DOUBLE  = 0.0;

void trim ( std::string& str );

void split ( std::vector<std::string>& vec, const std::string& src, char dim, bool delempty=false );

void split ( std::vector<std::string>& vec, const std::string& src, const char* dim, bool delempty=false );

void replace_all ( std::string& str, const std::string& from, const std::string& to );

bool contains ( const std::string& src, const std::string& dest );

void to_upper ( std::string& str );
    
void to_lower ( std::string& str );
    
inline bool iequals ( const std::string& str, const char* val )
{
    return 0 == strcmp ( str.c_str(), val );
}


int transform ( const std::string& str, int type );

int64_t transform ( const std::string& str, int64_t type );

unsigned transform ( const std::string& str, unsigned type );

uint64_t transform ( const std::string& str, uint64_t type );

double transform ( const std::string& str, double type );

template<class T>
std::string tostr ( const T& val )
{
    std::ostringstream os;
    os << val;
    return os.str();
};

#endif //__FUNC_H__

